// 获取元素引用
var modal = document.getElementById("myModal");
var btn = document.getElementById("openModalBtn");
var span = document.getElementsByClassName("close")[0];

// 当用户点击按钮时，打开弹窗
btn.onclick = function() {
  modal.style.display = "block";
}

// 当用户点击关闭符号时，关闭弹窗
span.onclick = function() {
  modal.style.display = "none";
}

// 当用户点击弹窗背景时，也关闭弹窗
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
